/* ********************************************************** */
// Test: Run a battleship game

import edu.upenn.seas.peerreview.{Id, Source, Sink}
import edu.upenn.seas.peerreview.transport.Transport
import edu.upenn.seas.peerreview.transport.Transport._
import edu.upenn.seas.peerreview.smui._
import edu.upenn.seas.peerreview.pr._

object RGRTester {
  // type TEL = PRLayer // switches in different implementations

  type TEL = PRSimple
  def wrapWithPR (myId:Id, transport:Sink.T, f:Source.Factory) : Source.T = {
    new TEL(myId, transport, f)
  }

  def main(args: Array[String]):Unit = {

    val trans : Transport = Transport.newLocal()
    
    trans.register (coordinatorName, (id,transport) => new RGRTestManager(id,transport))


    val ui = trans.register ("UI", (id,transport) => new RGRTestApp(id,transport))  

    for (rsrcs <- List(2, 5, 8)) {
      val sm = trans.register("SM", (id,t) => 
      wrapWithPR(id, t, (id,wrappedTransport) => new RGRTestClientSM(rsrcs)(id, wrappedTransport, ui)))
      0
    }
   
    0
  }
}
